#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <string.h>

int main()
{
    int n = 0;
    scanf("%d", &n);

    getchar();
    char word[1002][1002] = { 0 };
    for (int i = 0; i < n; i++)
        scanf("%s", word[i]);
    int max_len = 0;
    for (int i = 0; i < n; i++)
        max_len = ((strlen(word[i]) > max_len) ? strlen(word[i]) : max_len);
    for (int i = max_len - 1; i >= 0; i--)
    {
        for (int j = 0; j < n; j++)
        {
            if (i < strlen(word[j]))
                printf("%c", word[j][i]);
            else
                printf(" ");
        }
        printf("\n");
    }
    return 0;
}